feat: add coverage report generation with cargo-llvm-cov#1301
feat: add coverage report generation with cargo-llvm-cov#1301dblnz wants to merge 1 commit intohyperlight-dev:mainfrom
Conversation
There was a problem hiding this comment.
Its nice to see a report. Do you have thoughts on how do we ensure we are looking at this report and not just another artifact? Do we post an issue on run? post in release? Review at community meetings?
I ran it locally and I am seeing 70.42%, which quite high! Its nice to see this. I am not to worried about minor changes but would like to see it trending even or even improving over time.
ludfjig
left a comment
There was a problem hiding this comment.
This is awesome, I also tried it locally and works great. I only have one question: is this the recommended way to generate coverage reports (using cargo-llvm-cov), or are there alternative ways? I'm only asking because I am not familiar with this area.
| - name: Upload LCOV coverage report | ||
| if: always() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: coverage-lcov-${{ matrix.hypervisor }}-${{ matrix.cpu }} | ||
| path: target/coverage/lcov.info |
There was a problem hiding this comment.
I think there's an option to fail the workflow if the file is not found which could be useful. Should we also using existing framework/script to create an automatic issue if this workflow fails (like we do in another workflow)?
From the research I've done, there are two other alternatives to |
About this, I think we should definitely have this in mind when we do changes. Although, I wouldn't condition any PR on it as it takes a lot to run (same time the PR validations take). So maybe start with having this info as part of the release artifacts is a good start? Then we could see if we need to discuss it more often. One nice to have thing I was thinking about is to try and correlate the coverage output with the changes made in a PR so that we could have a check saying we are only testing |
|
You can check out how the summary looks like at: https://github.com/hyperlight-dev/hyperlight/actions/runs/22959438794?pr=1301 |
|
I am also looking at enabling the branch coverage report (it needs nightly). |
Another thought is if it drops by %5 to create an issue (we have some machinery that does this as part of other ci workflows). that would inform us that we've been going down. Otherwise this looks great and is a good first start. Feel free to move forward with this and do follow ups. |
Now that I'm back, I'll move this forward by addressing all the comments and suggestions. |
Add coverage infrastructure for the Hyperlight project: - Justfile: add coverage-run, coverage, coverage-html, coverage-lcov, and coverage-ci recipes using cargo-llvm-cov for LLVM source-based code coverage. Tests run once via coverage-run; report recipes just generate the desired output format from collected profdata. - CI: add Coverage.yml weekly workflow (Monday 06:00 UTC, manual trigger) running on kvm/amd with self-built guest binaries - coverage-ci mirrors test-like-ci by running multiple test phases with different feature combinations (default, single-driver, crashdump, tracing) and merging profdata into a single unified report - Coverage summary is displayed in the GitHub Actions Job Summary for quick viewing; full HTML report is downloadable as an artifact - docs: add how-to-run-coverage.md with local and CI usage instructions Guest/no_std crates are excluded from coverage because they define coverage instrumentation. Coverage targets host-side crates only. Closes hyperlight-dev#1190 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
808b8eb to
9622c18
Compare
| run: just coverage-ci ${{ matrix.hypervisor }} | ||
|
|
||
| - name: Coverage summary | ||
| if: always() |
There was a problem hiding this comment.
why do some of these have if: always()?
There was a problem hiding this comment.
Pull request overview
Adds Rust coverage report generation for Hyperlight using cargo-llvm-cov, including local just recipes, a scheduled CI workflow, and documentation for running coverage.
Changes:
- Introduces
justrecipes to collect coverage data and emit text/HTML/LCOV reports. - Adds a weekly (and manually triggerable) GitHub Actions workflow to generate and upload coverage artifacts.
- Adds documentation describing local and CI coverage usage and outputs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.
| File | Description |
|---|---|
| docs/how-to-run-coverage.md | New guide documenting local + CI coverage workflows and outputs. |
| Justfile | Adds cargo-llvm-cov install/bootstrap and coverage run/report recipes. |
| .github/workflows/Coverage.yml | Adds scheduled CI workflow to run coverage and publish summaries/artifacts. |
| paths: | ||
| - .github/workflows/Coverage.yml |
There was a problem hiding this comment.
pull_request.paths is mis-indented, which will make the workflow YAML invalid (or at least not behave as intended). Align paths: under pull_request: with two additional spaces (same indentation level as schedule:).
| paths: | |
| - .github/workflows/Coverage.yml | |
| paths: | |
| - .github/workflows/Coverage.yml |
| cargo +nightly llvm-cov report | ||
|
|
||
| # generate an HTML coverage report to target/coverage/html/ | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-html hypervisor="kvm": | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
|
|
||
| # generate LCOV coverage output to target/coverage/lcov.info | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-lcov hypervisor="kvm": | ||
| mkdir -p target/coverage | ||
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | ||
|
|
||
| # generate all coverage reports for CI: HTML + LCOV + text summary. | ||
| # (run `just guests` first to build guest binaries) | ||
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | ||
| mkdir -p target/coverage | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | ||
| cargo +nightly llvm-cov report | tee target/coverage/summary.txt |
There was a problem hiding this comment.
The report-generation commands don’t constrain the workspace/package set (unlike coverage-run, which explicitly excludes guest/no_std crates). Depending on cargo-llvm-cov behavior, report may attempt to (re)build or consider additional workspace members and could fail on excluded guest crates. Fix by passing the same package selection flags used during collection (e.g., {{ coverage-packages }} / explicit -p ...) to each cargo llvm-cov report ... invocation so report generation is pinned to host-side crates.
| cargo +nightly llvm-cov report | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-lcov hypervisor="kvm": | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | |
| # generate all coverage reports for CI: HTML + LCOV + text summary. | |
| # (run `just guests` first to build guest binaries) | |
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | |
| cargo +nightly llvm-cov report | tee target/coverage/summary.txt | |
| cargo +nightly llvm-cov report {{ coverage-packages }} | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-lcov hypervisor="kvm": | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --lcov --output-path target/coverage/lcov.info | |
| # generate all coverage reports for CI: HTML + LCOV + text summary. | |
| # (run `just guests` first to build guest binaries) | |
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --html --output-dir target/coverage/html | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --lcov --output-path target/coverage/lcov.info | |
| cargo +nightly llvm-cov report {{ coverage-packages }} | tee target/coverage/summary.txt |
| cargo +nightly llvm-cov report | ||
|
|
||
| # generate an HTML coverage report to target/coverage/html/ | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-html hypervisor="kvm": | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
|
|
||
| # generate LCOV coverage output to target/coverage/lcov.info | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-lcov hypervisor="kvm": | ||
| mkdir -p target/coverage | ||
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | ||
|
|
||
| # generate all coverage reports for CI: HTML + LCOV + text summary. | ||
| # (run `just guests` first to build guest binaries) | ||
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | ||
| mkdir -p target/coverage | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | ||
| cargo +nightly llvm-cov report | tee target/coverage/summary.txt |
There was a problem hiding this comment.
The report-generation commands don’t constrain the workspace/package set (unlike coverage-run, which explicitly excludes guest/no_std crates). Depending on cargo-llvm-cov behavior, report may attempt to (re)build or consider additional workspace members and could fail on excluded guest crates. Fix by passing the same package selection flags used during collection (e.g., {{ coverage-packages }} / explicit -p ...) to each cargo llvm-cov report ... invocation so report generation is pinned to host-side crates.
| cargo +nightly llvm-cov report | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-lcov hypervisor="kvm": | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | |
| # generate all coverage reports for CI: HTML + LCOV + text summary. | |
| # (run `just guests` first to build guest binaries) | |
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | |
| cargo +nightly llvm-cov report | tee target/coverage/summary.txt | |
| cargo +nightly llvm-cov report {{ coverage-packages }} | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-lcov hypervisor="kvm": | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --lcov --output-path target/coverage/lcov.info | |
| # generate all coverage reports for CI: HTML + LCOV + text summary. | |
| # (run `just guests` first to build guest binaries) | |
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --html --output-dir target/coverage/html | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --lcov --output-path target/coverage/lcov.info | |
| cargo +nightly llvm-cov report {{ coverage-packages }} | tee target/coverage/summary.txt |
| cargo +nightly llvm-cov report | ||
|
|
||
| # generate an HTML coverage report to target/coverage/html/ | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-html hypervisor="kvm": | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
|
|
||
| # generate LCOV coverage output to target/coverage/lcov.info | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-lcov hypervisor="kvm": | ||
| mkdir -p target/coverage | ||
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | ||
|
|
||
| # generate all coverage reports for CI: HTML + LCOV + text summary. | ||
| # (run `just guests` first to build guest binaries) | ||
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | ||
| mkdir -p target/coverage | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | ||
| cargo +nightly llvm-cov report | tee target/coverage/summary.txt |
There was a problem hiding this comment.
The report-generation commands don’t constrain the workspace/package set (unlike coverage-run, which explicitly excludes guest/no_std crates). Depending on cargo-llvm-cov behavior, report may attempt to (re)build or consider additional workspace members and could fail on excluded guest crates. Fix by passing the same package selection flags used during collection (e.g., {{ coverage-packages }} / explicit -p ...) to each cargo llvm-cov report ... invocation so report generation is pinned to host-side crates.
| cargo +nightly llvm-cov report | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-lcov hypervisor="kvm": | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | |
| # generate all coverage reports for CI: HTML + LCOV + text summary. | |
| # (run `just guests` first to build guest binaries) | |
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | |
| cargo +nightly llvm-cov report | tee target/coverage/summary.txt | |
| cargo +nightly llvm-cov report {{ coverage-packages }} | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-lcov hypervisor="kvm": | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --lcov --output-path target/coverage/lcov.info | |
| # generate all coverage reports for CI: HTML + LCOV + text summary. | |
| # (run `just guests` first to build guest binaries) | |
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --html --output-dir target/coverage/html | |
| cargo +nightly llvm-cov report {{ coverage-packages }} --lcov --output-path target/coverage/lcov.info | |
| cargo +nightly llvm-cov report {{ coverage-packages }} | tee target/coverage/summary.txt |
| cargo +nightly llvm-cov report | ||
|
|
||
| # generate an HTML coverage report to target/coverage/html/ | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-html hypervisor="kvm": | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
|
|
||
| # generate LCOV coverage output to target/coverage/lcov.info | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-lcov hypervisor="kvm": | ||
| mkdir -p target/coverage | ||
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | ||
|
|
||
| # generate all coverage reports for CI: HTML + LCOV + text summary. | ||
| # (run `just guests` first to build guest binaries) | ||
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | ||
| mkdir -p target/coverage | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | ||
| cargo +nightly llvm-cov report | tee target/coverage/summary.txt |
There was a problem hiding this comment.
The report-generation commands don’t constrain the workspace/package set (unlike coverage-run, which explicitly excludes guest/no_std crates). Depending on cargo-llvm-cov behavior, report may attempt to (re)build or consider additional workspace members and could fail on excluded guest crates. Fix by passing the same package selection flags used during collection (e.g., {{ coverage-packages }} / explicit -p ...) to each cargo llvm-cov report ... invocation so report generation is pinned to host-side crates.
| cargo +nightly llvm-cov report | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-lcov hypervisor="kvm": | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | |
| # generate all coverage reports for CI: HTML + LCOV + text summary. | |
| # (run `just guests` first to build guest binaries) | |
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info | |
| cargo +nightly llvm-cov report | tee target/coverage/summary.txt | |
| cargo +nightly llvm-cov report {{ coverage-packages }} | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html {{ coverage-packages }} | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-lcov hypervisor="kvm": | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info {{ coverage-packages }} | |
| # generate all coverage reports for CI: HTML + LCOV + text summary. | |
| # (run `just guests` first to build guest binaries) | |
| coverage-ci hypervisor="kvm": (coverage-run hypervisor) | |
| mkdir -p target/coverage | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html {{ coverage-packages }} | |
| cargo +nightly llvm-cov report --lcov --output-path target/coverage/lcov.info {{ coverage-packages }} | |
| cargo +nightly llvm-cov report {{ coverage-packages }} | tee target/coverage/summary.txt |
|
|
||
| # install cargo-llvm-cov if not already installed and ensure nightly toolchain + llvm-tools are available | ||
| ensure-cargo-llvm-cov: | ||
| command -v cargo-llvm-cov >/dev/null 2>&1 || cargo install cargo-llvm-cov |
There was a problem hiding this comment.
For reproducibility, consider installing cargo-llvm-cov with --locked (and optionally pinning a version) to avoid CI/local differences due to upstream crate updates.
| command -v cargo-llvm-cov >/dev/null 2>&1 || cargo install cargo-llvm-cov | |
| command -v cargo-llvm-cov >/dev/null 2>&1 || cargo install cargo-llvm-cov --locked |
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage hypervisor="kvm": | ||
| cargo +nightly llvm-cov report | ||
|
|
||
| # generate an HTML coverage report to target/coverage/html/ | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-html hypervisor="kvm": | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
|
|
||
| # generate LCOV coverage output to target/coverage/lcov.info | ||
| # for this to work you need to run `coverage-run hypervisor` before hand |
There was a problem hiding this comment.
Correct spelling: change 'before hand' to 'beforehand'.
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage hypervisor="kvm": | |
| cargo +nightly llvm-cov report | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| # for this to work you need to run `coverage-run hypervisor` beforehand | |
| coverage hypervisor="kvm": | |
| cargo +nightly llvm-cov report | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` beforehand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` beforehand |
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage hypervisor="kvm": | ||
| cargo +nightly llvm-cov report | ||
|
|
||
| # generate an HTML coverage report to target/coverage/html/ | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-html hypervisor="kvm": | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
|
|
||
| # generate LCOV coverage output to target/coverage/lcov.info | ||
| # for this to work you need to run `coverage-run hypervisor` before hand |
There was a problem hiding this comment.
Correct spelling: change 'before hand' to 'beforehand'.
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage hypervisor="kvm": | |
| cargo +nightly llvm-cov report | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| # for this to work you need to run `coverage-run hypervisor` beforehand | |
| coverage hypervisor="kvm": | |
| cargo +nightly llvm-cov report | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` beforehand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` beforehand |
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage hypervisor="kvm": | ||
| cargo +nightly llvm-cov report | ||
|
|
||
| # generate an HTML coverage report to target/coverage/html/ | ||
| # for this to work you need to run `coverage-run hypervisor` before hand | ||
| coverage-html hypervisor="kvm": | ||
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | ||
|
|
||
| # generate LCOV coverage output to target/coverage/lcov.info | ||
| # for this to work you need to run `coverage-run hypervisor` before hand |
There was a problem hiding this comment.
Correct spelling: change 'before hand' to 'beforehand'.
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage hypervisor="kvm": | |
| cargo +nightly llvm-cov report | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` before hand | |
| # for this to work you need to run `coverage-run hypervisor` beforehand | |
| coverage hypervisor="kvm": | |
| cargo +nightly llvm-cov report | |
| # generate an HTML coverage report to target/coverage/html/ | |
| # for this to work you need to run `coverage-run hypervisor` beforehand | |
| coverage-html hypervisor="kvm": | |
| cargo +nightly llvm-cov report --html --output-dir target/coverage/html | |
| # generate LCOV coverage output to target/coverage/lcov.info | |
| # for this to work you need to run `coverage-run hypervisor` beforehand |
| | Recipe | Output | Description | | ||
| |---|---|---| | ||
| | `just coverage-run` | profiling data | Runs tests with coverage instrumentation (must be run first) | | ||
| | `just coverage` | stdout | Text summary of line coverage | | ||
| | `just coverage-html` | `target/coverage/html/` | HTML report for browsing | | ||
| | `just coverage-lcov` | `target/coverage/lcov.info` | LCOV format for tooling | | ||
| | `just coverage-ci <hypervisor>` | All of the above | CI recipe: runs tests + generates HTML + LCOV + text summary | |
There was a problem hiding this comment.
The markdown table rows start with ||, which creates an extra empty first column and renders incorrectly in many markdown viewers. Use a single leading | for each row so the table renders as intended.
Add coverage infrastructure for the Hyperlight project:
Partially addresses #1190
Guest/no_std crates are excluded from coverage because they define #[panic_handler] and cannot be compiled for the host target under coverage instrumentation. Coverage targets host-side crates only.
This PR: